package org.example.studyonline.utils;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;

public class AuthUtils {
    public static Integer getUserID(){
        // 获取当前 Subject（即当前用户）
        Subject subject = SecurityUtils.getSubject();
        // 从 Session 中获取用户的 ID
        return (Integer) subject.getSession().getAttribute("userId");
    }
}
